package com.project.projectdemo.conf.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger2配置
 * 		http://ip:port/项目名/doc.html
 * @author MECHREVO
 *
 */
@Configuration
@EnableSwagger2
public class Swagger {
	@Bean
	public Docket createRestApi(){
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo())
				.groupName("rest接口API说明文档")
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.project.projectdemo.controller"))
				.paths(PathSelectors.any())
				.build();
	}
	
	private ApiInfo	apiInfo(){
		return new ApiInfoBuilder().title("API说明文档").description("接口说明文档").contact(new Contact("测试项目", "", "")).version("1.0.0").build();
	}
	
}
